import xlrd

data = xlrd.open_workbook('成绩单.xlsx')
x1 = data.sheet_by_name('高级语言程序设计')
x2 = data.sheet_by_name('数据结构')
x3 = data.sheet_by_name('一级所有数据')

no=1
name=2
Class=4
subNo=5
subject=6
score=7

len1=406
len2=131
len3=3159

def getCell(x,y,table):
    val=table.cell(x, y).value
    return val

def getScore(x,table):
    s=getCell(x,score,table)
    if not isinstance(s,float):
        if s=='优秀':
            return 90
        elif s=='良好':
            return 80
        elif s=='中等':
            return 70
        elif s=='及格' or s=='通过':
            return 60
        elif s=='不及格' or s=='不通过':
            return 50
        else:
            print(s)
            raise s
    else:
        return s

def writeFile(filePath, content):
    # 将文件内容写到文件中
    with open(filePath, 'a', encoding='ansi') as f:
        f.write(content)

def readFile(filepath):
    f=open(filepath,'r')
    return f.read()


